package util;

import java.util.concurrent.*;

/**
 * 分治 +并行
 */


class forkjoin extends RecursiveTask{
    //start end
    int end;
    int start;
    //一个分治衡量值
    private int boundary = 100000;

    //提供分治线程池
    ExecutorService pool = new ForkJoinPool(); //->默认并行数即为CPU

    public forkjoin(int start, int end) {this.start = start;this.end = end;}

    /**
     * 传入start,end计算累加和
     */
    @Override
    protected Object compute() {
//        if (end - start < boundary) {
//            for (int i = start; i < end; i++) {
//                i = i + 1;
//            }
//        }
        return null;
    }

    /**
     * 并行流
     */
    public void parallel(){}
}

